<template>
	<view class="order-detail">
		<view class="head">
			<view class="status">
				<view>
					<text v-if="order_detail.status === '1'">等待发货</text>
					<text v-if="order_detail.status === '2'">等待收货</text>
					<text v-if="order_detail.status === '3'">交易完成</text>
				</view>
			</view>
		</view>
		<view class="order">
			<view class="order-item">
				<view class="item-left">
					<view class="img">
						<image :src="order_detail.listImage"></image>
					</view>
				</view>
				<view class="item-right">
					<view class="title">
						<text>{{order_detail.title}}</text>
					</view>
					<view class="price">
						<text>积分:</text>
						<text>{{order_detail.costIntegral}}</text>
					</view>
				</view>
			</view>
		</view>
		<!--订单描述-->
		<view class="order-desc">
			<view class="desc">
				<view class="order-num">
					<text class="title">订单号:</text>
					<text class="content">{{order_detail.orderNumber}}</text>
				</view>
				<view class="order-time">
					<text class="title">兑换时间:</text>
					<text class="content">{{order_detail.createTime}}</text>
				</view>
				<view class="line-1"></view>
				<view class="pay-type">
					<text class="title">支付方式:</text>
					<text class="content">积分兑换</text>
				</view>
			</view>
		</view>
		<!--地址信息-->
		<view class="address-info">
			<view class="address">
				<view class="address-up">
					<text class="title">收货地址:</text>
					<view class="name">
						<text>{{order_detail.receiver}}</text>
						<text>{{order_detail.receiverPhone}}</text>
					</view>
				</view>
				<view class="address-down">
					<view class="address-detail">
						<text>{{order_detail.shippingAddress}}</text>
					</view>
				</view>
			</view>
		</view>
		<!--金额-->
		<view class="price-info">
			<view class="price">
				<view class="title">
					<view class="title-name">
						<text>商品积分</text>
					</view>
					<view class="title-price">
						<text>{{order_detail.costIntegral}}</text>
					</view>
				</view>
				<view class="real-pay">
					<view>
						<text>实扣积分：</text>
						<text>{{order_detail.costIntegral}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="pay-button">

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				order_detail: {},
				order_id: '',

			};
		},
		onLoad: function(option) {
			this.order_id = option.id
			this.getDetail(this.order_id)
		},
		methods: {

			getDetail: function(order_id) {
				let params = {
					id: order_id
				}
				this.$postApi(this.$path.INTEGRAL_ORDER_BY_ID, params).then(res => {
					console.log("订单详情返回------------->", res.data)
					if (res.data.success) {
						this.order_detail = res.data.data
					} else {
						this.pub.showError(res.data.error.errorMessage)
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.order-detail {
		padding: 0;
		margin: 0;
		min-height: 100%;
		background: #f2f2f2;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.head {
		height: 200upx;
		background: linear-gradient(87deg, rgba(249, 140, 45, 1) 0%, rgba(250, 108, 46, 1) 100%);
		padding: 40upx;
		display: flex;
		align-items: center;

		.status {
			view:first-child {
				font-size: 36upx;
				font-family: PingFang SC;
				font-weight: bold;
				color: rgba(255, 255, 255, 1);
			}

		}

		.status .tips {
			font-size: 24upx;
			font-family: PingFang SC;
			font-weight: 300;
			color: rgba(255, 255, 255, 1);

		}
	}

	.order {
		padding: 30upx;
		background: #fff;
	}

	.order-item {
		display: flex;

		.item-left {
			width: 20%;
		}

		.img {
			width: 112upx;
			height: 112upx;
			border-radius: 7upx;

			image {
				border-radius: 7upx;
			}
		}

		.item-right {
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			width: 80%;
		}
		.title {
			font-size: 34upx;
			font-family: PingFang SC;
			font-weight: bold;
			color: rgba(51, 51, 51, 1);
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}

		.price {
			font-size: 30upx;
			font-family: PingFang SC;
			font-weight: bold;
			color: rgba(255, 94, 4, 1);
			line-height: 42upx;
		}

		.price text:last-child {
			font-size: 28upx;
			font-family: PingFang SC;
			font-weight: 500;
			color: rgba(102, 102, 102, 1);
			line-height: 42upx;
			margin-left: 5upx;
		}

	}

	.order-desc {
		padding: 30upx;
		background: #fff;
		margin-top: 20upx;

		.desc .title {
			font-size: 26upx;
			font-family: PingFang SC;
			font-weight: bold;
			color: rgba(77, 77, 77, 1);
			line-height: 34px;
			letter-spacing: 4upx;
		}

		.line-1 {
			height: 1upx;
			width: 100%;
			border: 1upx solid #F4F4F4;
		}

		.desc .content {
			font-size: 26upx;
			margin-left: 14upx;
			font-family: PingFang SC;
			color: rgba(77, 77, 77, 1);
			line-height: 34px;
		}
	}

	.address-info {
		padding: 30upx;
		background: #fff;
		margin-top: 20upx;

		.address {
			display: flex;
			flex-direction: column;
			padding: 5upx 0 5upx 0; 
		}

		.address-up {
			display: flex;
			align-items: flex-end;
		}

		.address-up .title {
			font-size: 28upx;
			font-family: PingFang SC;
			font-weight: bold;
			color: rgba(77, 77, 77, 1);
			// line-height: 34upx;
			letter-spacing: 4upx;
		}

		.name {
			font-size: 28upx;
			margin-left: 10upx;
			font-family: PingFang SC;
			font-weight: bold;
			color: rgba(26, 26, 26, 1);
			letter-spacing: 4upx;
			// line-height: 37upx;
		}

		.name text:last-child {
			margin-left: 10upx;
		}

		.address-down {
			margin-top: 20upx;
			display: flex;
			justify-content: flex-end;

			.address-detail {
				width: 79%;
				font-size: 24upx;
				font-family: PingFang SC;
				// font-weight:300;
				color: rgba(26, 26, 26, 1);
				line-height: 33upx;
			}
		}
	}

	.price-info {
		padding: 30upx;
		background: #fff;
		margin-top: 20upx;

		.title {
			display: flex;
			justify-content: space-between;
			border-bottom: 1upx solid #f5f5f5;
			padding-bottom: 20upx;

			.title-name {
				font-size: 29upx;
				font-family: PingFang SC;
				font-weight: bold;
				color: rgba(77, 77, 77, 1);
			}

			.title-price {
				font-size: 29upx;
				font-family: PingFang SC;
				font-weight: bold;
				color: rgba(1, 1, 1, 1);
			}
		}

		.real-pay {
			margin-top: 30upx;
			display: flex;
			justify-content: flex-end;
		}

		.real-pay view {
			width: 35%;
			display: flex;
			justify-content: flex-end;
			align-items: center;
			text:first-child {
				font-size: 29upx;
				font-family: PingFang SC;
				font-weight: bold;
				color: rgba(77, 77, 77, 1);
			}

			text:last-child {
				font-size: 35upx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #FF5E04;
			}
		}
	}

	.pay-button {
		padding: 30upx;
		display: flex;
		justify-content: flex-end;
		align-items: center;

		view {
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 26upx;
			width: 159upx;
			height: 55upx;
			border: 1px solid rgba(204, 204, 204, 1);
			border-radius: 28upx;
			margin-left: 16upx;
			letter-spacing: 3upx;
		}

		.cancel,
		.del {
			color: rgba(128, 128, 128, 1);
		}

		.pay {
			color: rgba(255, 94, 4, 1);
			border: 1px solid rgba(255, 94, 4, 1);
		}
	}
</style>
